<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.littcore.com/core" prefix="li" %>
<%@ attribute name="moduleCode" required="true" rtexprvalue="true" %>
<%@ attribute name="defaultUrl" required="false" rtexprvalue="true" %>
<c:set var="contextPath" value="${pageContext.request.contextPath}"/>
<div class="row-fluid quickview">
  <div class="pull-left">
    <ul class="inline" id="quickview-list">
      <li><i class="icon-filter"></i></li>    
      <li <c:if test="${empty param.qv }">class="active"</c:if>><a href="${empty defaultUrl?'index.do':defaultUrl }">
        <s:message code="quickView.all" /></a></li> 
    </ul>
  </div>  
    <div class="pull-right hide" id="quickview-config">
      <div class="btn-group">
        <a class="btn dropdown-toggle btn-small" data-toggle="dropdown" href="#">
          <i class="icon-cog"></i>
        </a>
        <ul class="dropdown-menu" id="quickview-config-list">        
          <!-- dropdown menu links -->          
        </ul>
      </div>
    </div>
  <div class="clear"></div>
</div>
<script src="${contextPath }/static/js/quickview.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){		
  var qvId = "${param.qv }";
  
  $.webtools.ajax({
		url: "${contextPath}/assistant/quickview/findByModule.json",
		params: {"moduleCode":"${moduleCode}"},
		success: function(reply) {
		  var quickviewList = reply.quickviewList;
		  var dom = "";
		  var config_dom = "";
		  $.each(quickviewList, function(i, n){
			dom = dom + "<li id=\"quickview_"+ n.id  + "\" class=\"" + (n.id==qvId?'active':'')  + "\"><a href=\"javascript:;\" onclick=\"$.quickview.jump(" + n.id  + ")\" title=\"" + n.descr + "\" data-toggle=\"tooltip\">"+ n.name + "</a></li>";
			config_dom = config_dom + "<li><a href=\"javascript:;\" onclick=\"$.quickview.jump(" + n.id  + ")\" title=\"" + n.descr + "\">" + n.name  +"</a>&nbsp;&nbsp;<a href=\"javascript:;\" title=\"Delete\" onclick=\"$.quickview.deleteById(" + n.id + ");\"><i class=\"icon-remove-sign\"></i></a></li>";
		    
		  });
		  $("#quickview-list").append(dom);	
		  if(quickviewList.length>0)
		  {
		    $("#quickview-config-list").append(config_dom);	
		    $("#quickview-config").show();
		  }
		  else
		  {
		    $("#quickview-config").hide();
		  }
		}
  });		
  
});

//-->
</script>

